Skip to content

feat!: allow dynamic infura networks#9432

Open
mikesposito wants to merge 5 commits into
mainfrom
me/WPN-1554-allow-dynamic-infura-networks
Open

feat!: allow dynamic infura networks#9432
mikesposito wants to merge 5 commits into
mainfrom
me/WPN-1554-allow-dynamic-infura-networks

Conversation

@mikesposito

@mikesposito mikesposito commented Jul 8, 2026

Copy link
Copy Markdown
Member

Explanation

Currently, NetworkController manages two types of network config: Infura and Custom. The Infura type is dedicated to configurations with RPC endpoints with an Infura URL that uses a template string for the project ID, while Custom configurations are generic network configurations that can be also added by users.

In order to add a network configuration of Infura type to NetworkController, the network must first be added to @metamask/controller-utils to satisfy NetworkController validations, or else it won’t be recognized as a known network, and the operation will fail with an error. This currently blocks us from leveraging mm-config-registry (Dynamic registry) from being used to add Infura network configurations remotely.

This PR relaxes NetworkController validations to accept Infura configurations that are not included in @metamask/controller-utils, nor in any other bundled known list.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

High Risk
Breaking changes to core network client resolution, add/update validation, and eth_chainId scaffolding affect all RPC traffic; consumers must adopt new types and error strings.

Overview
NetworkController no longer requires Infura-backed networks to appear in @metamask/controller-utils. Infura configs can use arbitrary subdomain strings and chain IDs without cross-checking the URL against a bundled network list.

Breaking types: BuiltInNetworkClientId and InfuraNetworkClientConfiguration.network are now plain string instead of InfuraNetworkType. Consumers that narrowed on known Infura names should use NetworkClientType on the client configuration instead.

Validation removed: custom RPC endpoints may reuse IDs that look like built-in Infura names, and add/update no longer rejects mismatches between chainId and the Infura URL’s implied network.

Runtime behavior: getNetworkClientById resolves Infura then custom clients without isInfuraNetworkType gating and throws a single message (No network client was found with ID "…"). Infura provider middleware answers eth_chainId from the configuration’s chainId rather than ChainId[network]. Downstream tests (e.g. assets-controllers) were updated for the new error text.

Reviewed by Cursor Bugbot for commit 58ad075. Bugbot is set up for automated code reviews on this repo. Configure here.

@mikesposito mikesposito force-pushed the me/WPN-1554-allow-dynamic-infura-networks branch from 21722a6 to ce206bd Compare July 8, 2026 19:23
@mikesposito

This comment was marked as outdated.

1 similar comment
@mikesposito

This comment was marked as outdated.

@mikesposito

Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.5.5-preview-a2621f612
@metamask-previews/accounts-controller@39.0.5-preview-a2621f612
@metamask-previews/address-book-controller@7.1.2-preview-a2621f612
@metamask-previews/ai-controllers@0.8.0-preview-a2621f612
@metamask-previews/analytics-controller@1.2.1-preview-a2621f612
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-a2621f612
@metamask-previews/announcement-controller@8.1.0-preview-a2621f612
@metamask-previews/app-metadata-controller@2.0.1-preview-a2621f612
@metamask-previews/approval-controller@9.0.2-preview-a2621f612
@metamask-previews/assets-controller@11.0.0-preview-a2621f612
@metamask-previews/assets-controllers@109.4.1-preview-a2621f612
@metamask-previews/authenticated-user-storage@3.0.1-preview-a2621f612
@metamask-previews/base-controller@9.1.0-preview-a2621f612
@metamask-previews/base-data-service@0.1.3-preview-a2621f612
@metamask-previews/bitcoin-regtest-up@1.0.0-preview-a2621f612
@metamask-previews/bridge-controller@77.4.1-preview-a2621f612
@metamask-previews/bridge-status-controller@74.1.2-preview-a2621f612
@metamask-previews/build-utils@3.0.4-preview-a2621f612
@metamask-previews/chain-agnostic-permission@1.7.0-preview-a2621f612
@metamask-previews/chomp-api-service@3.1.0-preview-a2621f612
@metamask-previews/claims-controller@0.5.3-preview-a2621f612
@metamask-previews/client-controller@1.0.1-preview-a2621f612
@metamask-previews/client-utils@1.1.0-preview-a2621f612
@metamask-previews/compliance-controller@2.1.0-preview-a2621f612
@metamask-previews/composable-controller@12.0.1-preview-a2621f612
@metamask-previews/config-registry-controller@0.4.1-preview-a2621f612
@metamask-previews/connectivity-controller@0.3.0-preview-a2621f612
@metamask-previews/controller-utils@12.3.0-preview-a2621f612
@metamask-previews/core-backend@6.5.0-preview-a2621f612
@metamask-previews/delegation-controller@3.0.2-preview-a2621f612
@metamask-previews/earn-controller@12.2.2-preview-a2621f612
@metamask-previews/eip-5792-middleware@3.0.5-preview-a2621f612
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-a2621f612
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-a2621f612
@metamask-previews/ens-controller@19.1.5-preview-a2621f612
@metamask-previews/eth-block-tracker@15.0.1-preview-a2621f612
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-a2621f612
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-a2621f612
@metamask-previews/foundryup@1.0.1-preview-a2621f612
@metamask-previews/gas-fee-controller@26.2.4-preview-a2621f612
@metamask-previews/gator-permissions-controller@4.2.3-preview-a2621f612
@metamask-previews/geolocation-controller@0.1.3-preview-a2621f612
@metamask-previews/java-tron-up@1.0.0-preview-a2621f612
@metamask-previews/json-rpc-engine@10.5.0-preview-a2621f612
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-a2621f612
@metamask-previews/keyring-controller@27.1.0-preview-a2621f612
@metamask-previews/local-node-utils@1.0.0-preview-a2621f612
@metamask-previews/logging-controller@8.0.2-preview-a2621f612
@metamask-previews/message-manager@14.1.2-preview-a2621f612
@metamask-previews/messenger@2.0.0-preview-a2621f612
@metamask-previews/messenger-cli@0.2.0-preview-a2621f612
@metamask-previews/money-account-api-data-service@0.1.0-preview-a2621f612
@metamask-previews/money-account-balance-service@2.2.0-preview-a2621f612
@metamask-previews/money-account-controller@0.3.3-preview-a2621f612
@metamask-previews/money-account-upgrade-controller@2.2.1-preview-a2621f612
@metamask-previews/multichain-account-service@13.0.0-preview-a2621f612
@metamask-previews/multichain-api-middleware@4.0.1-preview-a2621f612
@metamask-previews/multichain-network-controller@3.2.1-preview-a2621f612
@metamask-previews/multichain-transactions-controller@7.1.1-preview-a2621f612
@metamask-previews/name-controller@9.1.2-preview-a2621f612
@metamask-previews/network-connection-banner-controller@0.1.0-preview-a2621f612
@metamask-previews/network-controller@34.0.0-preview-a2621f612
@metamask-previews/network-enablement-controller@5.5.0-preview-a2621f612
@metamask-previews/notification-services-controller@25.0.0-preview-a2621f612
@metamask-previews/passkey-controller@2.0.1-preview-a2621f612
@metamask-previews/permission-controller@13.1.1-preview-a2621f612
@metamask-previews/permission-log-controller@5.1.0-preview-a2621f612
@metamask-previews/perps-controller@9.2.1-preview-a2621f612
@metamask-previews/phishing-controller@17.2.1-preview-a2621f612
@metamask-previews/platform-api-docs@0.0.0-preview-a2621f612
@metamask-previews/polling-controller@16.0.8-preview-a2621f612
@metamask-previews/preferences-controller@23.1.0-preview-a2621f612
@metamask-previews/profile-metrics-controller@4.0.2-preview-a2621f612
@metamask-previews/profile-sync-controller@28.3.0-preview-a2621f612
@metamask-previews/ramps-controller@17.0.0-preview-a2621f612
@metamask-previews/rate-limit-controller@7.0.1-preview-a2621f612
@metamask-previews/react-data-query@0.2.1-preview-a2621f612
@metamask-previews/remote-feature-flag-controller@4.2.2-preview-a2621f612
@metamask-previews/sample-controllers@5.0.3-preview-a2621f612
@metamask-previews/seedless-onboarding-controller@10.0.3-preview-a2621f612
@metamask-previews/selected-network-controller@26.1.5-preview-a2621f612
@metamask-previews/shield-controller@5.1.3-preview-a2621f612
@metamask-previews/signature-controller@39.2.7-preview-a2621f612
@metamask-previews/smart-transactions-controller@25.0.1-preview-a2621f612
@metamask-previews/snap-account-service@2.0.0-preview-a2621f612
@metamask-previews/social-controllers@2.5.0-preview-a2621f612
@metamask-previews/solana-test-validator-up@1.0.0-preview-a2621f612
@metamask-previews/stellar-quickstart-up@0.0.0-preview-a2621f612
@metamask-previews/storage-service@1.0.2-preview-a2621f612
@metamask-previews/subscription-controller@6.2.1-preview-a2621f612
@metamask-previews/transaction-controller@69.0.0-preview-a2621f612
@metamask-previews/transaction-pay-controller@25.0.0-preview-a2621f612
@metamask-previews/user-operation-controller@41.2.7-preview-a2621f612
@metamask-previews/wallet@7.0.1-preview-a2621f612
@metamask-previews/wallet-cli@0.0.0-preview-a2621f612

@mikesposito mikesposito marked this pull request as ready for review July 14, 2026 19:19
@mikesposito mikesposito requested review from a team as code owners July 14, 2026 19:19
Comment thread packages/network-controller/CHANGELOG.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant